
/**
 * @Project : Clion_ProgrammingExercises
 * @File : 0869
 * @Author : WangRuoyu 
 * @Date : 2023/5/23 16:48
 */

#include "iostream"
#include "vector"
#include "algorithm"

using namespace std;

int main() {
    int n;
    scanf("%d", &n);

    while (n--) {
        int x;
        scanf("%d", &x);
        vector<int> res;

        for (int i = 1; i <= x / i; ++i) {
            if (x % i == 0) {
                res.push_back(i);
                if (x / i != i) res.push_back(x / i);
            }
        }
        sort(res.begin(), res.end());

        for (int &i: res) {
            printf("%d ", i);
        }
        printf("\n");
    }

    return 0;
}